﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using NLite.Interceptor.Metadata;

namespace NLite.Interceptor.Matcher
{
    /// <summary>
    /// 
    /// </summary>
    [Contract]
    public interface IAspectMatcher
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TTargetTypeInfo"></typeparam>
        /// <typeparam name="TClassMatcher"></typeparam>
        void RegisterClassMatcher<TTargetTypeInfo, TClassMatcher>()
            where TTargetTypeInfo : ITargetTypeInfo
            where TClassMatcher : IClassMatcher, new();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetType"></param>
        /// <param name="aspects"></param>
        /// <returns></returns>
        IEnumerable<IAspectInfo> Match(Type targetType, IEnumerable<IAspectInfo> aspects);
    }

    /// <summary>
    /// 
    /// </summary>
    public interface IClassMatcher
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetType"></param>
        /// <param name="aspect"></param>
        /// <returns></returns>
        bool Match(Type targetType, IAspectInfo aspect);
    }

    /// <summary>
    /// 
    /// </summary>
    public interface IJoinPointMatcher
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetType"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        IEnumerable<ICutPointInfo> Match(Type targetType, MethodInfo method);
    }

}
